<?php
namespace app\shop\model;
use app\BaseModel;
use think\facade\Db;



class IndexCardCount extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_count';

    /**
     * @param $dis
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * 获取雷达记录
     */
    public function countSelect($dis){
        $data = $this->where($dis)->select();
        return !empty($data)?$data->toArray():$data;
    }

    /**
     * @param $dis
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * 获取雷达记录
     */
    public function countInfo($dis){
        $data = $this->where($dis)->find();
        return !empty($data)?$data->toArray():$data;
    }
    /**
     * @param $data
     * @return int|string
     * 添加雷达记录
     */
    public function countAdd($data){
        $data['create_time'] = time();
        $data['update_time'] = time();
        $res = $this->insert($data);
        $res = $this->getLastInsID();
        return $res;
    }
    /**
     * @param $data
     * @return int|string
     * 编辑雷达记录
     */
    public function countUpdate($dis,$data){
        $data['update_time'] = time();
        $res = $this->where($dis)->update($data);
        return $res;
    }




}